﻿Imports System.Data
Imports System.Data.SqlClient
Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine
Imports System.Configuration.ConfigurationManager
Partial Class IntraReportCuatro
    Inherits System.Web.UI.Page

    Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click
        Response.Redirect("IntraReportesMenu.aspx")
    End Sub

    'instanciar la conexion
    Dim cn As New SqlConnection(ConnectionStrings("cn").ConnectionString)

    Private Function Estadistica() As DataTable
        Dim da As New SqlDataAdapter("usp_Estadistica", cn)
        da.SelectCommand.CommandType = CommandType.StoredProcedure
        Dim tb As New DataTable
        da.Fill(tb)
        Return tb
    End Function

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim rp As New ReportDocument
        rp.Load(Server.MapPath("rptEstadisticaMeses.rpt"))
        rp.SetDataSource(Estadistica)

        CrystalReportViewer1.ReportSource = rp
        CrystalReportViewer1.DataBind()
    End Sub
End Class
